<?xml version='1.0'?>
<xsl:stylesheet  version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:msxsl="urn:schemas-microsoft-com:xslt"
	xmlns:StringManipulations="urn:StringManipulations">
	
	<xsl:output method="text" indent="yes" encoding="utf-16" />
	
	<msxsl:script language="VBScript" implements-prefix="StringManipulations">
		Function ToLower(s As String)
		ToLower =  LCase(s)
		End Function

		Function mySplit(s As String, sep as String)
		mySplit =  Split(s, sep)
		End Function
	</msxsl:script>

	<xsl:template match="/">
		<BodyPart>
			<xsl:text/>
			<xsl:for-each select="BodyPart/*">
				<xsl:choose>

					<xsl:when test="local-name()='tx'">
						<xsl:call-template name="tx">
							<xsl:with-param name="tx_counter" >
								<xsl:number value="position()" format="1"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>

					<xsl:when test="local-name()='let'">
						<xsl:call-template name="let"/>
					</xsl:when>

					<xsl:when test="local-name()='eh'">
						<xsl:call-template name="eh">
							<xsl:with-param name="eh_counter">
								<xsl:number value="position()" format="1"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>

					<xsl:when test="local-name()='fr'">
						<xsl:call-template name="fr">
							<xsl:with-param name="fr_counter">
								<xsl:number value="position()" format="1.1"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>

					<xsl:when test="local-name()='bib'">
						<xsl:call-template name="bib">
							<xsl:with-param name="bib_counter">
								<xsl:number value="position()" format="1.1"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>

					<xsl:when test="local-name()='cau'">
						<xsl:call-template name="cau">
							<xsl:with-param name="cauname" select="."/>
							<xsl:with-param name="applyCloseListBibl">
								<xsl:if test="local-name() = name(preceding-sibling::*[1])">0</xsl:if>
								<xsl:if test="local-name() != name(preceding-sibling::*[1])">1</xsl:if>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>

					<xsl:when test="local-name()='salso'">
						<xsl:call-template name="salso">
							<xsl:with-param name="salso_counter">
								<xsl:number value="position()" format="1.1"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>

					<xsl:when test="local-name()='h1'">
						<xsl:call-template name="h1">
							<xsl:with-param name="h1_counter">
								<xsl:number value="position()" format="1.1"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>

					<xsl:when test="local-name()='disclaimer'">
						<xsl:call-template name="disclaimer"/>
					</xsl:when>

					<xsl:when test="local-name()='exso'">
						<xsl:call-template name="exso"/>
					</xsl:when>

					<xsl:when test="local-name()='see'">
						<xsl:call-template name="see"/>
					</xsl:when>

					<xsl:when test="local-name()='ex'">
						<xsl:call-template name="ex"/>
					</xsl:when>

					<xsl:when test="local-name()='h5'">
						<xsl:call-template name="h5"/>
					</xsl:when>

					<xsl:when test="local-name()='en'">
						<xsl:call-template name="en"/>
					</xsl:when>

					<xsl:when test="local-name()='h2'">
						<xsl:call-template name="h2">
							<xsl:with-param name="h2_counter">
								<xsl:number value="position()" format="1.1"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>
					
					<xsl:when test="local-name()='h3'">
						<xsl:call-template name="h3">
							<xsl:with-param name="h3_counter">
								<xsl:number value="position()" format="1.1"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>
					
					<xsl:when test="local-name()='h4'">
						<xsl:call-template name="h4">
							<xsl:with-param name="h4_counter">
								<xsl:number value="position()" format="1.1"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>
					
					<xsl:when test="local-name()='plg'">
						<xsl:call-template name="plg"/>
					</xsl:when>

					<xsl:when test="local-name()='auso'">
						<xsl:call-template name="auso"/>
					</xsl:when>

					<xsl:when test="local-name()='e'">
						<xsl:call-template name="e"/>
					</xsl:when>

					<xsl:when test="local-name()='verse'">
						<xsl:call-template name="verse"/>
					</xsl:when>

					<xsl:when test="local-name()='vso'">
						<xsl:call-template name="vso"/>
					</xsl:when>

					<xsl:when test="local-name()='ct'">
						<xsl:call-template name="ct"/>
					</xsl:when>

					<xsl:when test="local-name()='da'">
						<xsl:call-template name="da"/>
					</xsl:when>

					<xsl:when test="local-name()='cst'">
						<xsl:call-template name="cst"/>
					</xsl:when>

					<xsl:when test="local-name()='enexso'">
						<xsl:call-template name="enexso"/>
					</xsl:when>

					<xsl:when test="local-name()='ep'">
						<xsl:call-template name="ep"/>
					</xsl:when>

					<xsl:when test="local-name()='i'">
						<xsl:call-template name="i"/>
					</xsl:when>

					<xsl:when test="local-name()='au'">
						<xsl:call-template name="au">
							<xsl:with-param name="auname" select="."/>
						</xsl:call-template>
					</xsl:when>

					<xsl:when test="local-name()='pn'">
						<xsl:call-template name="pn">
							<xsl:with-param name="pnComplete" select="."/>
						</xsl:call-template>
					</xsl:when>

					<xsl:when test="local-name()='pt'">
						<xsl:call-template name="pt"/>
					</xsl:when>

					<xsl:when test="local-name()='cn'">
						<xsl:call-template name="cn"/>
					</xsl:when>
					
				</xsl:choose>
			</xsl:for-each>
	<xsl:text>&#10;</xsl:text>
		</BodyPart>
	</xsl:template>

	<!--Template for <let> tag starts here-->
	<xsl:template name="let">
		<xsl:text>&#10;</xsl:text>
		<div id = "{StringManipulations:ToLower(.)}" type = "letter" n = "{StringManipulations:ToLower(.)}">
			<xsl:text>&#10;&#09;</xsl:text>
			<head type = "main">
				<xsl:text>&#10;&#09;&#09;</xsl:text>
				<xsl:value-of select="."/>
				<xsl:text>&#10;&#09;</xsl:text>
			</head>
			<xsl:text>&#10;</xsl:text>
		</div>
	</xsl:template>
	<!--Template for <let> tag starts here-->

	<!--Template for <tx> tag starts here-->
	<xsl:template name="tx">
		<xsl:param name="tx_counter" select="1"/>
		<xsl:text>&#10;</xsl:text>
		<div id = "w168bddiv{$tx_counter}" type = "section">
			<xsl:text>&#10;&#09;</xsl:text>
			<p>
				<xsl:text>&#10;&#09;&#09;</xsl:text>
				<xsl:if test="b">
					<hi rend = "bold">
						<xsl:value-of select="b" disable-output-escaping="yes" />
					</hi>
				</xsl:if>
				<xsl:if test="i">
					<hi rend = "italic">
						<xsl:value-of select="i" disable-output-escaping="yes" />
					</hi>
				</xsl:if>
				<xsl:value-of select="./text()" disable-output-escaping="yes"/>
				<xsl:text>&#10;&#09;</xsl:text>
			</p>
			<xsl:text>&#10;</xsl:text>
		</div>
	</xsl:template>
	<!--Template for <tx> tag ends here-->

	<!--Template for <eh> tag starts here-->
	<xsl:template name="eh">
		<xsl:param name="eh_counter" select="1"/>
		<xsl:text>&#10;</xsl:text>
		<div id = "w168bddiv{$eh_counter}" type = "entry">
			<xsl:text>&#10;&#09;</xsl:text>
			<head type = "main">
				<xsl:text>&#10;&#09;&#09;</xsl:text>
				<orig reg ="{.}">
					<xsl:text>&#10;&#09;&#09;&#09;</xsl:text>
					<xsl:value-of select="."/>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
				</orig>
				<xsl:text>&#10;&#09;</xsl:text>
			</head>
			<xsl:text>&#10;</xsl:text>
		</div>
	</xsl:template>
	<!--Template for <eh> tag ends here-->

	<!--Template for <fr> tag starts here-->
	<xsl:template name="fr">
		<xsl:param name="fr_counter" select="1.1"/>
		<xsl:text>&#10;</xsl:text>
		<div id = "w168bddiv{$fr_counter}" type = "bibl">
			<xsl:text>&#10;&#09;</xsl:text>
			<head type = "main">
				<xsl:text>&#10;&#09;&#09;</xsl:text>
				<orig reg ="Bibliography">
					<xsl:text>&#10;&#09;&#09;&#09;</xsl:text>
					<xsl:value-of select="."/>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
				</orig>
				<xsl:text>&#10;&#09;</xsl:text>
			</head>
			<xsl:text>&#10;</xsl:text>
		</div>
		<xsl:text>&#10;</xsl:text>
		<xsl:text disable-output-escaping="yes">&lt;listBibl&gt;</xsl:text>
	</xsl:template>
	<!--Template for <fr> tag ends here-->

	<!--Template for <bib> tag starts here-->
	<xsl:template name="bib">
		<xsl:param name="bib_counter" select="1.1"/>
		<xsl:text>&#10;</xsl:text>
		<bibl id = "w168bddiv{$bib_counter}">
			<xsl:variable name="countOfauname" select="count(auname)"/>
			<xsl:variable name="aunames" select="auname"/>
			<xsl:call-template name="auname">
				<xsl:with-param name="startNo" select="1"/>
				<xsl:with-param name="total" select="$countOfauname"/>
				<xsl:with-param name="aunames" select="$aunames"/>
				<xsl:with-param name="forenames" select="text()[1]"/>
			</xsl:call-template>
			(<date>
				<xsl:value-of select="pubdate"/>
			</date>)
			<xsl:call-template name="bibtitle">
				<xsl:with-param name="pubPlace" select="substring-before(substring-after(text()[$countOfauname + 1], '.'), ':')"/>
				<xsl:with-param name="publisher" select="substring-before(substring-after(text()[$countOfauname + 1], ':'), ',')"/>
			</xsl:call-template>

			<xsl:text>&#10;</xsl:text>
			<xsl:text>&#10;</xsl:text>
		</bibl>
	</xsl:template>
	<!--Template for <bibl> tag ends here-->

	<!--Template for <bibtitle> tag starts here-->
	<xsl:template name="bibtitle">
		<xsl:param name="pubPlace" select="pubPlace"/>
		<xsl:param name="publisher" select="publisher"/>
		<xsl:text>&#10;&#09;</xsl:text>
		<title level="m">
			<xsl:text>&#10;&#09;&#09;</xsl:text>
			<hi rend = "italic">
				<xsl:for-each select="bibtitle/i">
					<xsl:value-of select="." disable-output-escaping="yes" />
					<xsl:text>&#32;</xsl:text>
				</xsl:for-each>
			</hi>
			<xsl:text>&#10;&#09;&#09;</xsl:text>
			<pubPlace>
				<xsl:copy-of select="$pubPlace"/>
			</pubPlace>
			<xsl:text>&#10;&#09;&#09;</xsl:text>
			<publisher>
				<xsl:copy-of select="$publisher"/>
			</publisher>
			<xsl:text>&#10;&#09;</xsl:text>
		</title>
	</xsl:template>
	<!--Template for <bibtitle> tag ends here-->

	<!--Template for <auname> tag starts here-->
	<!--It is a recursive function. It calls itself with same parameter values except $startNo which increments after every call.-->
	<xsl:template name="auname">
		<xsl:param name="startNo" select="1"/>
		<!--counter, starts with 1, incements with every recursion-->
		<xsl:param name="total" select="1"/>
		<!--Count of <auname> tags.-->
		<xsl:param name="aunames" select="aunames"/>
		<!--It expects array of <auname> tags with contained values.-->
		<xsl:param name="forenames" select="forenames"/>
		<!--It expects simple string value. If author is more than one, the forenames will be sperated with ' and '-->
		<xsl:if test="$startNo &lt;= $total">
			<xsl:text>&#10;&#09;</xsl:text>
			<author>
				<persName>
					<surname>
						<xsl:copy-of select="$aunames[$startNo]/text()"/>
					</surname>
					<foreName>
						<xsl:if test="$total = 1">
							<!--if there is only one <auname> tag-->
							<xsl:copy-of select="substring-after($forenames, ', ')"/>
						</xsl:if>
						<xsl:if test="$total != 1">
							<!--if there is more than one <auname> tags-->
							<xsl:if test="$startNo = 1">
								<xsl:copy-of select="substring-after(substring-before($forenames, ' and '), ', ')"/>
							</xsl:if>
							<xsl:if test="$startNo != 1">
								<xsl:copy-of select="substring-after($forenames, ' and ')"/>
							</xsl:if>
						</xsl:if>

					</foreName>
				</persName>
			</author>
		</xsl:if>
		<xsl:if test="$startNo &lt;= $total">
			<xsl:call-template name="auname">
				<xsl:with-param name="startNo" select="$startNo + 1"/>
				<!--incrementing the counter value-->
				<xsl:with-param name="total" select="$total"/>
				<xsl:with-param name="aunames" select="$aunames"/>
				<xsl:with-param name="forenames" select="$forenames"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<!--Template for <auname> tag ends here-->

	<!--Template for <cau> tag starts here-->
	<xsl:template name="cau">
		<xsl:param name="cauname" select="cauname"/>
		<xsl:param name="applyCloseListBibl" select="1"/>
		<xsl:text>&#10;</xsl:text>
		<xsl:if test="$applyCloseListBibl = 1">
			<xsl:text disable-output-escaping="yes">&lt;/listBibl&gt;</xsl:text>
		</xsl:if>
		<xsl:text>&#10;</xsl:text>
		
		<xsl:variable name="cauNameSplitted">
			<xsl:call-template name="split">
				<xsl:with-param name="list" select="$cauname"/>
				<xsl:with-param name="seperator">
					<xsl:text>&#32;</xsl:text>
				</xsl:with-param>

			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="countOfNameParts" select="count(msxsl:node-set($cauNameSplitted)/id)"/>
		<xsl:if test="$countOfNameParts = 1">
			<byline>
				<xsl:text>&#10;&#09;</xsl:text>
				<persName type = "main">
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<foreName type ="first">
						<xsl:copy-of select="msxsl:node-set($cauNameSplitted)/id[1]/text()"/>
					</foreName>
					<xsl:text>&#10;&#09;</xsl:text>
				</persName>
				<xsl:text>&#10;</xsl:text>
			</byline>

		</xsl:if>
		<xsl:if test="$countOfNameParts = 2">
			<byline>
				<xsl:text>&#10;&#09;</xsl:text>
				<persName type = "main">
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<foreName type ="first">
						<xsl:copy-of select="msxsl:node-set($cauNameSplitted)/id[1]/text()"/>
					</foreName>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<surname>
						<xsl:copy-of select="msxsl:node-set($cauNameSplitted)/id[2]/text()"/>
					</surname>
					<xsl:text>&#10;&#09;</xsl:text>
				</persName>
				<xsl:text>&#10;</xsl:text>
			</byline>

		</xsl:if>
		<xsl:if test="$countOfNameParts &gt;= 3">
			<byline>
				<xsl:text>&#10;&#09;</xsl:text>
				<persName type = "main">
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<foreName type ="first">
						<xsl:copy-of select="msxsl:node-set($cauNameSplitted)/id[$countOfNameParts - 2]/text()"/>
					</foreName>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<foreName full ="init" type ="middle">
						<xsl:copy-of select="msxsl:node-set($cauNameSplitted)/id[$countOfNameParts - 1]/text()"/>
					</foreName>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<surname>
						<xsl:copy-of select="msxsl:node-set($cauNameSplitted)/id[$countOfNameParts]/text()"/>
					</surname>
					<xsl:text>&#10;&#09;</xsl:text>
				</persName>
				<xsl:text>&#10;</xsl:text>
			</byline>
		</xsl:if>

	</xsl:template>
	<!--Template for <cau> tag ends here-->

	<!--Template for <split> tag starts here-->
	<xsl:template name="split">
		<xsl:param name="list" />
		<xsl:param name="seperator" xml:space="preserve"><xsl:text>&#32;</xsl:text></xsl:param>
		
		<xsl:variable name="newlist">
			<xsl:if test="substring($list, string-length($list), 1) = $seperator">
				<xsl:copy-of select="$list" />
			</xsl:if>
			<xsl:if test="substring($list, string-length($list), 1) != $seperator">
				<xsl:copy-of select="concat(normalize-space($list), $seperator)" />
			</xsl:if>

		</xsl:variable>
		<xsl:variable name="first" select="substring-before($newlist, $seperator)" />
		<xsl:variable name="remaining" select="substring-after($newlist, $seperator)" />
		<id>
			<xsl:value-of select="$first" />
		</id>
		<xsl:if test="$remaining">
			<xsl:call-template name="split">
				<xsl:with-param name="list" select="$remaining" />
				<xsl:with-param name="seperator" select="$seperator" />
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<!--Template for <split> tag ends here-->
	<!--Template for <salso> tag starts here-->
	<xsl:template name="salso">
		<xsl:param name="salso_counter" select="1"/>
		<xsl:text>&#10;</xsl:text>
		<div id = "w168bddiv{$salso_counter}" type = "section">
			<xsl:text>&#10;&#09;</xsl:text>
			<head type = "main">See also</head>
			<xsl:text>&#10;</xsl:text>
			<xsl:variable name="salso">
				<xsl:call-template name="split">
					<xsl:with-param name="list" select="."/>
					<xsl:with-param name="seperator">
						<xsl:text>;</xsl:text> 
					</xsl:with-param>
				</xsl:call-template>
			</xsl:variable>
			<xsl:for-each select="msxsl:node-set($salso)/id">
				<p>
					<ref target="xxxxxx">
						<xsl:value-of select="."/>
					</ref>
				</p>
				<xsl:text>&#10;</xsl:text>
			</xsl:for-each>
		</div>
	</xsl:template>
	<!--Template for <salso> tag ends here-->
	
	<!--Template for <h1> tag starts here-->
	<xsl:template name="h1">
		<xsl:param name="h1_counter" select="1"/>
		<xsl:text>&#10;</xsl:text>
		<div id = "w168bddiv{$h1_counter}" type = "section">
			<xsl:value-of select="text()"/>
		</div>
	</xsl:template>
	<!--Template for <h1> tag ends here-->

	<!--Template for <disclaimer> tag starts here-->
	<xsl:template name="disclaimer">
		<xsl:text>&#10;</xsl:text>
		<div  type = "note">
			<xsl:value-of select="text()"/>
		</div>
	</xsl:template>
	<!--Template for <disclaimer> tag ends here-->

	<!--Template for <exso> tag starts here-->
	<xsl:template name="exso">
		<xsl:text>&#10;</xsl:text>
		<note>
			<xsl:value-of select="text()"/>
		</note>
	</xsl:template>
	<!--Template for <exso> tag ends here-->

	<!--Template for <see> tag starts here-->
	<xsl:template name="see">
		<xsl:text>&#10;</xsl:text>
		<p>
			<ref target="xxxxxx">
				<xsl:value-of select="text()"/>
			</ref>
		</p>
	</xsl:template>
	<!--Template for <see> tag ends here-->

	<!--Template for <ex> tag starts here-->
	<xsl:template name="ex">
		<xsl:text>&#10;</xsl:text>
		<cit>
			<quote>
				<p>
					<xsl:value-of select="text()"/>
				</p>
			</quote>
		</cit>
	</xsl:template>
	<!--Template for <ex> tag ends here-->

	<!--Template for <h5> tag starts here-->
	<xsl:template name="h5">
		<xsl:text>&#10;</xsl:text>

		<p>
			<xsl:value-of select="text()"/>
		</p>
	</xsl:template>
	<!--Template for <h5> tag ends here-->

	<!--()(((((((((())))))))))))))))))))))))))))))-->
	<!--Template for <en> tag starts here-->
	<xsl:template name="en">
		<xsl:text>&#10;</xsl:text>
		<note>
			<xsl:value-of select="text()"  disable-output-escaping="yes"/>
		</note>
	</xsl:template>
	<!--Template for <en> tag ends here-->
	
	<!--Template for <h2> tag starts here-->
	<xsl:template name="h2">
		<xsl:param name="h2_counter" select="1"/>
		<xsl:text>&#10;</xsl:text>
		<div id = "w168bddiv{$h2_counter}" type = "section">
			<head type="main">
				<orig reg ="{.}">
					<xsl:value-of select="text()" />
				</orig>
			</head>
		</div>
	</xsl:template>
	<!--Template for <h2> tag ends here-->

	<!--Template for <h3> tag starts here-->
	<xsl:template name="h3">
		<xsl:param name="h3_counter" select="1"/>
		<xsl:text>&#10;</xsl:text>
		<div id = "w168bddiv{$h3_counter}" type = "section">
			<head type="main">
				<orig reg ="{.}">
					<xsl:value-of select="text()"/>
				</orig>
			</head>
		</div>
	</xsl:template>
	<!--Template for <h3> tag ends here-->

	<!--Template for <h4> tag starts here-->
	<xsl:template name="h4">
		<xsl:param name="h4_counter" select="1"/>
		<xsl:text>&#10;</xsl:text>
		<div id = "w168bddiv{$h4_counter}" type = "section">
			<head type="main">
				<orig reg ="{.}">
					<xsl:value-of select="text()"/>
				</orig>
			</head>
		</div>

	</xsl:template>
	<!--Template for <h4> tag ends here-->
	
	<!--Template for <plg> tag starts here-->
	<xsl:template name="plg">
		<xsl:text>&#10;</xsl:text>
		<p>
		<xsl:value-of select="./text()[1]" disable-output-escaping="yes"/>
				<xsl:if test="i">
					<hi rend = "italic">
						<xsl:value-of select="i" disable-output-escaping="yes" />
					</hi>
				</xsl:if>
				<xsl:value-of select="./text()[2]" disable-output-escaping="yes"/>
			</p>
			<xsl:text>&#10;</xsl:text>
	</xsl:template>
	<!--Template for <plg> tag ends here-->

	<!--Template for <auso> tag starts here-->
	<xsl:template name="auso">
		<xsl:text>&#10;</xsl:text>
		<p>
			<xsl:value-of select="./text()[1]" disable-output-escaping="yes"/>
			<xsl:if test="i">
				<hi rend = "italic">
					<xsl:value-of select="i" disable-output-escaping="yes" />
				</hi>
			</xsl:if>
			<xsl:value-of select="./text()[2]" disable-output-escaping="yes"/>
		</p>
		<xsl:text>&#10;</xsl:text>
	</xsl:template>
	<!--Template for <auso> tag ends here-->
	
	<!--Template for <e> tag starts here-->
	<xsl:template name="e">
		<xsl:text>&#10;</xsl:text>
		<div type ="entry">
			<xsl:value-of select="./text()[1]" disable-output-escaping="yes"/>
			<xsl:if test="i">
				<hi rend = "italic">
					<xsl:value-of select="i" disable-output-escaping="yes" />
				</hi>
			</xsl:if>
			<xsl:value-of select="./text()[2]" disable-output-escaping="yes"/>
		</div>
	</xsl:template>
	<!--Template for <auso> tag ends here-->

	<!--Template for <verse> tag starts here-->
	<xsl:template name="verse">
		<xsl:text>&#10;</xsl:text>
		<cit>
			<quote>
				<p>
					<xsl:value-of select="text()"  disable-output-escaping="yes"/>
				</p>
			</quote>
		</cit>
	</xsl:template>
	<!--Template for <verse> tag ends here-->

	<!--Template for <vso> tag starts here-->
	<xsl:template name="vso">
		<xsl:text>&#10;</xsl:text>
		<note>
			<xsl:value-of select="text()" disable-output-escaping="yes"/>
		</note>
	</xsl:template>
	<!--Template for <vso> tag ends here-->

	<!--Template for <ct> tag starts here-->
	<xsl:template name="ct">
		<xsl:text>&#10;</xsl:text>
		<div type="part">
			<xsl:value-of select="text()"  disable-output-escaping="yes"/>
		</div>
	</xsl:template>
	<!--Template for <ct> tag ends here-->

	<!--Template for <da> tag starts here-->
	<xsl:template name="da">
		<xsl:text>&#10;</xsl:text>
		<p>
			<xsl:value-of select="text()"  disable-output-escaping="yes"/>
		</p>
	</xsl:template>
	<!--Template for <da> tag ends here-->

	<!--Template for <cst> tag starts here-->
	<xsl:template name="cst">
		<xsl:text>&#10;</xsl:text>
		<div type= "section">
			<xsl:value-of select="text()"  disable-output-escaping="yes"/>
		</div>
	</xsl:template>
	<!--Template for <cst> tag ends here-->

	<!--Template for <enexso> tag starts here-->
	<xsl:template name="enexso">
		<xsl:text>&#10;</xsl:text>
		<note>
			<xsl:value-of select="./text()[1]" disable-output-escaping="yes"/>
			<xsl:if test="i">
				<hi rend = "italic">
					<xsl:value-of select="i" disable-output-escaping="yes" />
				</hi>
			</xsl:if>
			<xsl:value-of select="./text()[2]" disable-output-escaping="yes"/>
		</note>
	</xsl:template>
	<!--Template for <enexso> tag ends here-->

	<!--Template for <ep> tag starts here-->
	<xsl:template name="ep">
		<xsl:text>&#10;</xsl:text>
		<p>
			<xsl:value-of select="text()"  disable-output-escaping="yes"/>
		</p>
	</xsl:template>
	<!--Template for <ep> tag ends here-->

	<!--Template for <i> tag starts here-->
	<xsl:template name="i">
		<xsl:text>&#10;</xsl:text>
		<hi rend="italic">
			<xsl:value-of select="text()"  disable-output-escaping="yes"/>
		</hi>
	</xsl:template>
	<!--Template for <i> tag ends here-->

	<!--Template for <au> tag starts here-->
	<xsl:template name="au">
		<xsl:param name="auname" select="cauname"/>
		<xsl:text>&#10;</xsl:text>
		<xsl:variable name="auNameSplitted">
			<xsl:call-template name="split">
				<xsl:with-param name="list" select="$auname"/>
				<xsl:with-param name="seperator">
					<xsl:text>&#32;</xsl:text>
				</xsl:with-param>

			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="countOfNameParts" select="count(msxsl:node-set($auNameSplitted)/id)"/>
		<xsl:if test="$countOfNameParts = 1">
			<author>
				<xsl:text>&#10;&#09;</xsl:text>
				<persName>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<foreName type ="first">
						<xsl:copy-of select="msxsl:node-set($auNameSplitted)/id[1]/text()"/>
					</foreName>
					<xsl:text>&#10;&#09;</xsl:text>
				</persName>
				<xsl:text>&#10;</xsl:text>
			</author>

		</xsl:if>
		<xsl:if test="$countOfNameParts = 2">
			<author>
				<xsl:text>&#10;&#09;</xsl:text>
				<persName>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<foreName type ="first">
						<xsl:copy-of select="msxsl:node-set($auNameSplitted)/id[1]/text()"/>
					</foreName>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<surname>
						<xsl:copy-of select="msxsl:node-set($auNameSplitted)/id[2]/text()"/>
					</surname>
					<xsl:text>&#10;&#09;</xsl:text>
				</persName>
				<xsl:text>&#10;</xsl:text>
			</author>

		</xsl:if>
		<xsl:if test="$countOfNameParts &gt;= 3">
			<author>
				<xsl:text>&#10;&#09;</xsl:text>
				<persName>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<foreName type ="first">
						<xsl:copy-of select="msxsl:node-set($auNameSplitted)/id[$countOfNameParts - 2]/text()"/>
					</foreName>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<foreName full ="init" type ="middle">
						<xsl:copy-of select="msxsl:node-set($auNameSplitted)/id[$countOfNameParts - 1]/text()"/>
					</foreName>
					<xsl:text>&#10;&#09;&#09;</xsl:text>
					<surname>
						<xsl:copy-of select="msxsl:node-set($auNameSplitted)/id[$countOfNameParts]/text()"/>
					</surname>
					<xsl:text>&#10;&#09;</xsl:text>
				</persName>
				<xsl:text>&#10;</xsl:text>
			</author>
		</xsl:if>

	</xsl:template>
	<!--Template for <au> tag ends here-->

	<!--Template for <pn> tag starts here-->
	<xsl:template name="pn">
			<xsl:param name="pnComplete" select="pnComplete"/>
			<xsl:text>&#10;</xsl:text>
			<xsl:variable name="pnNameSplitted">
				<xsl:call-template name="split">
					<xsl:with-param name="list" select="$pnComplete"/>
					<xsl:with-param name="seperator">
						<xsl:text>&#32;</xsl:text>
					</xsl:with-param>
				</xsl:call-template>
			</xsl:variable>
			<xsl:variable name="countOfpnParts" select="count(msxsl:node-set($pnNameSplitted)/id)"/>
			<xsl:if test="$countOfpnParts = 1">
				<seg type ="part">
					<xsl:text>&#10;&#09;</xsl:text>
					<orig reg="Part">
						<xsl:text>&#10;&#09;</xsl:text>
					</orig>
					<xsl:copy-of select="msxsl:node-set($pnNameSplitted)/id[1]/text()"/>
					<xsl:text>&#10;</xsl:text>
				</seg>

			</xsl:if>
		<xsl:if test="$countOfpnParts = 2">
			<seg type ="part">
				<xsl:text>&#10;&#09;</xsl:text>
				<orig>
					<xsl:attribute name="reg">
						<xsl:copy-of select="msxsl:node-set($pnNameSplitted)/id[1]/text()"/>
					</xsl:attribute>
					<xsl:text>&#10;&#09;</xsl:text>
				</orig>
				<xsl:copy-of select="msxsl:node-set($pnNameSplitted)/id[2]/text()"/>
				<xsl:text>&#10;</xsl:text>
			</seg>

		</xsl:if>
	</xsl:template>
	<!--Template for <pn> tag ends here-->
	
	<!--Template for <pt> tag starts here-->
	<xsl:template name="pt">
		<xsl:text>&#10;</xsl:text>
		<seg type="title">
			<orig>
				<xsl:attribute name="reg">
					<xsl:value-of select="."/>
				</xsl:attribute>
				<xsl:value-of select="."/>
			</orig>
		</seg>
	</xsl:template>
	<!--Template for <pt> tag ends here-->

	<!--Template for <cn> tag starts here-->
	<xsl:template name="cn">
		<xsl:text>&#10;</xsl:text>
		<pb>
			<xsl:attribute name="n">
				<xsl:value-of select="."/>
			</xsl:attribute>
		</pb>
	</xsl:template>
	<!--Template for <cn> tag ends here-->
</xsl:stylesheet>